//***************************************************************************
//*
//*	File:			dswl_textdocument.h
//*	Description:	Wrapper for ITextDocument interface
//*
//***************************************************************************
//*
//*	Note:			This source code is provided "as is" meaning that you may 
//*					use it at your own risk. 
//*					You are free to use it in any way you like.
//*
//***************************************************************************
//*
//*	History:		
//*
//*	-------------------------------------------------------------------------
//*	2003/07/27	|	Initial release									|	rk
//*	-------------------------------------------------------------------------
//*
//***************************************************************************

//
//-------------------------------------------------------------- PREPROCESSOR 
//

#ifndef			_DSWL_TEXTDOCUMENT_H_INCLUDED
#define			_DSWL_TEXTDOCUMENT_H_INCLUDED

#if				_MSC_VER > 1000
#pragma once
#ifdef			__SWITCH_SHOW_HEADER
#pragma message ("-- dswl_textdocument.h\n")
#endif
#ifdef			__SWITCH_SHOW_HEADER_TREE
#pragma message ("-- "__FILE__"\n")
#endif
#endif 

#ifdef			_DSWL_SWITCH_USE_AUTOCAST
#ifdef			_DSWL_SWITCH_USE_UNSAFE_AUTOCAST
#pragma	message ( "-- dswl_textdocument.h \t Warning: Generating auto-cast operator: CITextDocument::operator ITextDocument* () const" )
#else
#pragma	message ( "-- dswl_textdocument.h \t Warning: Generating auto-cast operator: CITextDocument::operator       ITextDocument* ()" )
#pragma	message ( "-- dswl_textdocument.h \t Warning: Generating auto-cast operator: CITextDocument::operator const ITextDocument* () const" )
#endif
#endif

//
//-------------------------------------------------------------- DEPENDENCIES
//

//
//------------------------------------------------------ FORWARD DECLARATIONS
//

class			CIApplication		;
class			CITextSelection		;
class			CIGenericDocument	;

//
//--------------------------------------------------------- CLASS DECLARATION
//

//***************************************************************************
//**	@DOC		CLASS CITextDocument
//***************************************************************************
//*		@CLASS		Wrapper for ITextDocument interface
//***************************************************************************
class _DSWL_EXT_CLASS CITextDocument  
{
	//																								
	//-----------------------------------------------------------------------						
	//***************************     ATTRIBS     ***************************						
	//-----------------------------------------------------------------------						
	//																								
private:																											// @ACCESS	Private Attributes	
			CComPtr< ITextDocument >	m_pITextDocument	;														// @CMEMBER	Smart pointer to the actual text document interface
																											
	//																														
	//-----------------------------------------------------------------------												
	//*************************     PROPERTIES     **************************						
	//-----------------------------------------------------------------------												
	//																														
public:																												// @ACCESS	Public Property Methods
			CIApplication		GetApplication		( void )											const	;	// @CMEMBER	Determines the application this document belongs to
			CITextSelection		GetTextSelection	( void )											const	;	// @CMEMBER	Determines the text document's current selection
			CString				GetLanguage			( void )											const	;	// @CMEMBER	Determines the document's language
			long				GetTabSize			( void )											const	;	// @CMEMBER	Determines the current tab size
			long				GetIndentSize		( void )											const	;	// @CMEMBER	Determines the current indent size

			void				SetLanguage			( const CString&				a_strLanguage	)			;	// @CMEMBER	Sets the document's language
			void				SetTabSize			(		long					a_lTabSize		)			;	// @CMEMBER	Sets the tab size
			void				SetIndentSize		(		long					a_lIndentSize	)			;	// @CMEMBER	Sets the indent size
																									
	//																														
	//-----------------------------------------------------------------------												
	//*************************     INFORMATION     *************************
	//-----------------------------------------------------------------------												
	//																														
public:																												// @ACCESS	Public Information Methods
			BOOL				IsNull				( void )											const	;	// @CMEMBER	Determines whether the internal pointer is <t NULL>
			BOOL				IsValid				( void )											const	;	// @CMEMBER	Determines whether the internal pointer differs from <t NULL>

			CIGenericDocument	GetGenericDocument	( void )											const	;	// @CMEMBER Determines the text document's generic document interface

	//																														
	//-----------------------------------------------------------------------												
	//************************     MODIFICATION     *************************						
	//-----------------------------------------------------------------------												
	//																														
public:																												// @ACCESS	Public Bookmark Methods
			void				ClearBookmarks		( void )													;	// @CMEMBER	Clears all boomarks
public:																												// @ACCESS	Public Search and Replace Methods
			BOOL				MarkText			( const	CString&				a_strFind
													,		DWORD					a_dwFlags		)			;	// @CMEMBER	Finds and marks the next occurance of the specified text
			BOOL				ReplaceText			( const	CString&				a_strFind
													, const	CString&				a_strReplace
													,		DWORD					a_dwFlags		)			;	// @CMEMBER	Replaces all occurances of the specified text with the specified replace string

	//																												
	//-----------------------------------------------------------------------										
	//**************************     OPERATORS     **************************										
	//-----------------------------------------------------------------------										
	//																												
public:																												// @ACCESS	Public Operators
			bool				operator	==		( const CITextDocument&			a_Other			)	const	;	// @CMEMBER	Comparison operator
			bool				operator	!=		( const CITextDocument&			a_Other			)	const	;	// @CMEMBER	Comparison operator
			bool				operator	<=		( const CITextDocument&			a_Other			)	const	;	// @CMEMBER	Comparison operator
			bool				operator	>=		( const CITextDocument&			a_Other			)	const	;	// @CMEMBER	Comparison operator
			bool				operator	<		( const CITextDocument&			a_Other			)	const	;	// @CMEMBER	Comparison operator
			bool				operator	>		( const CITextDocument&			a_Other			)	const	;	// @CMEMBER	Comparison operator
																									
			CITextDocument&		operator	=		(		ITextDocument*			a_pIOther		)			;	// @CMEMBER	Copy operator
			CITextDocument&		operator	=		(		IGenericDocument*		a_pIOther		)			;	// @CMEMBER	Assignment operator
			CITextDocument&		operator	=		(		CIGenericDocument		a_pIOther		)			;	// @CMEMBER	Assignment operator
																									
			ITextDocument*		operator	*		( void )													;	// @CMEMBER	Dereference operator
	const	ITextDocument*		operator	*		( void )											const	;	// @CMEMBER	Dereference operator
																									
			ITextDocument*		operator	->		( void )													;	// @CMEMBER	Member access operator
	const	ITextDocument*		operator	->		( void )											const	;	// @CMEMBER	Member access operator

	#ifdef	_DSWL_SWITCH_USE_AUTOCAST
	#ifdef	_DSWL_SWITCH_USE_UNSAFE_AUTOCAST
								operator			ITextDocument*	( void )							const	;	// @CMEMBER	TypeCast operator
	#else
								operator			ITextDocument*	( void )									;	// @CMEMBER	TypeCast operator
								operator	const	ITextDocument*	( void )							const	;	// @CMEMBER	TypeCast operator
	#endif
	#endif

	//																								
	//-----------------------------------------------------------------------						
	//***********************     CON/DESTRUCTION     ***********************						
	//-----------------------------------------------------------------------						
	//																								
public:																												// @ACCESS	Public Con-/Destruction Methods	
	explicit CITextDocument( int				a_iFoo					);											// @CMEMBER	Invalidation constructor
			 CITextDocument( CIGenericDocument	a_pITextDocument		);											// @CMEMBER	Converison constructor
			 CITextDocument( IGenericDocument*	a_pITextDocument		);											// @CMEMBER	Converison constructor
			 CITextDocument( ITextDocument*		a_pITextDocument = NULL );											// @CMEMBER	Default constructor
	virtual ~CITextDocument();																						// @CMEMBER	Default destructor
};
//***************************************************************************
//**	@END
//***************************************************************************

#endif		// _DSWL_TEXTDOCUMENT_H_INCLUDED
